﻿/*----------------------------------------------------------------
// Copyright (C) 2011 王冲
// 版权所有。 
//
// 文件名：InventoryInfoSelInfo
// 文件功能描述：食材库存查询
//
// 
// 创建标识：2012-04-01
//
// 修改标识：
// 修改描述：
//
//
//----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DAO.WaiGaoQiao;

namespace Model.WaiGaoQiao
{
    public class InventoryInfoSelInfo
    {
        /// <summary>
        /// 食材编号
        /// </summary>
        public string GoodsNo
        {
            get;
            set;
        }

        /// <summary>
        /// 食材名称
        /// </summary>
        public string GoodsName
        {
            get;
            set;
        }
        /// <summary>
        /// 单价
        /// </summary>
        public decimal PRICE
        {
            get;
            set;
        }
        /// <summary>
        /// 数量
        /// </summary>
        public int STOCKS_COUNT
        {
            get;
            set;
        }

        private DataAccessInventoryInfoSel dar;
        private int InventoryInfoSelcount;
        public int _InventoryInfoSelcount
        {
            get { return InventoryInfoSelcount; }
        }
        public InventoryInfoSelInfo(bool isgetcount)
        {
            dar = new DataAccessInventoryInfoSel();
            if (isgetcount)
            {
                InventoryInfoSelcount = GetInventoryInfoSelCount();
            }
        }
        public InventoryInfoSelInfo()
        { }
        /// <summary>
        /// 获取主副调食材的库存数量
        /// </summary>
        /// <returns></returns>
        public int GetInventoryInfoSelCount()
        {
            return dar.GetInventoryInfoSelCount();
        }

        /// <summary>
        /// 获取主副调食材库存信息（分页）
        /// </summary>
        /// <param name="pagesize"></param>
        /// <param name="startindex"></param>
        /// <returns></returns>
        public IList<InventoryInfoSelInfo> SelInventoryInfoSelInfo(int pagesize, int startindex, string strquery, string Warehouse_ID,out int count)
        {
            IList<InventoryInfoSelInfo> invlist = new List<InventoryInfoSelInfo>();
            InventoryInfoSelInfo invinfo;
            DataSet ds = dar.SelInventoryInfoSelInfo(pagesize, startindex, strquery, Warehouse_ID,out count);
            foreach (DataRow item in ds.Tables[0].Rows)
            {
                invinfo = new InventoryInfoSelInfo();
                invinfo.GoodsNo = item["GOODSNO"].ToString();
                invinfo.GoodsName = item["GoodsName"].ToString();
                invinfo.PRICE = Convert.ToDecimal(item["PRICE"]);
                invinfo.STOCKS_COUNT = Convert.ToInt32(item["STOCKS_COUNT"]);
                invlist.Add(invinfo);
            }
            return invlist;
        }
    }
}
